package org.zeuzgroup.general;

import java.awt.Color;
import java.awt.Point;

public class Bar {

	private Point from;
	private Point to;
	private int actual;
	private String name;
	
	private int offSet;

	private Color color;
	

	
	

	public Bar(String name,int offSet, Color color) {
		super();
		this.name=name;
		this.offSet = offSet;
		this.color = color;
	}

	
	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public int getOffSet() {
		return offSet;
	}

	/**
	 * setOffSet are how far colors can stray an still be within acceptable
	 * range
	 * 
	 * @param sensivity
	 */
	public void setOffSet(int offSet) {
		this.offSet = offSet;
	}

	public Color getColor() {
		return color;
	}

	/**
	 * the color of the health bar
	 * 
	 * @param color
	 */
	public void setColor(Color color) {
		this.color = color;
	}

	public Point getFrom() {
		return from;
	}

	public void setFrom(Point from) {
		this.from = from;
	}

	public Point getTo() {
		return to;
	}

	public void setTo(Point to) {
		this.to = to;
	}

	public int getActual() {
		return actual;
	}

	public void setActual(int actual) {
		this.actual = actual;
	}

	public Float getHPInPercent() {
		if (from.x > 0) {
			float trueTo = to.x - from.x;
			return (actual / trueTo) * 100;
		}
		if (from.x == 0) {
			return (actual / Float.valueOf(to.x)) * 100;
		}
		return Float.valueOf(0);

	}

	public boolean isFromAndToAssigned() {
		if (from != null && to != null) {
			return true;
		}
		return false;

	}

}
